from builtins import locals, type

from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.http import HttpResponse, JsonResponse
from django.core.cache import cache

from .SQLAlchemy import get_apiv2_baotaip

# SQLAlchemy 对数据库的增删改查
def index(request):

    bt = get_apiv2_baotaip()
    print(bt)
    return render(request, "example/index.html",  locals(), content_type='text/html')


def testcache(request):

    cache.set('my_key', 'hello, world!', 30)
    cache_test = cache.get('my_key')
    print(cache_test)
    return render(request, "example/testcache.html", locals(), content_type='text/html')

